<?php
chdir("../");
header("content-type: text/html; charset=utf-8");
require "../config/config.php";
require "../config/attributes.php";
require GALAXYTOOL_ROOT."/secret/includes/authorization.inc.php";
session_start();
$NO_PAGE_FORWARD = true;
require GALAXYTOOL_ROOT."/secret/includes/logincheck.inc.php";
require GALAXYTOOL_ROOT."/secret/includes/messages.inc.php";
require GALAXYTOOL_ROOT."/secret/includes/notices.inc.php";
if (isset($error_page_code) && $error_page_code == "timeout") exit("");

Galaxytool::load_language_file($_SESSION['lang']);

if ($_SESSION['s_auth']->get_permission(iAuthorization::permission_cansearch) !== true) exit("no permission");

if (!isset($_GET['playerid']) || !is_numeric($_GET['playerid'])) exit("playerid missing");
$player_id = intval($_GET['playerid']);

try {
	$notices    = new Notices($global_mysql_con, $noticetable, $playertable);
} catch (Exception $e) {
	exit("Exception occurred: ".$e);
}

$notice_content = $notices->get_notice($player_id);
if ($notice_content === false) {
	$error = $notices->get_error_object();
	echo Layout::print_messages($error);
	exit();
} else {
	echo Messages::get_bb_2_html($notice_content['noticetext']);
	exit();
}
